UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EgW0bi+BPaOi6fAXOJqhG3rxRjLGkI0QzB/D1n91cxo=' 
WHERE 
  key_id = '2183c72d867707160c0c080bd589b38818f8767c2b8403fa4be2f39dbd40866d' 
  AND (
    token = 'EgW0bi+BPaOi6fAXOJqhG3rxRjLGkI0QzB/D1n91cxo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023