UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uRG/buqMfN5LCucCB9ka4okcp5v6JcpEQuUrYcnhFCQ=' 
WHERE 
  key_id = 'b402f57a5f12a45de861afb4b15638b751df62ca0b9be84830ff76d677c2db78' 
  AND (
    token = 'uRG/buqMfN5LCucCB9ka4okcp5v6JcpEQuUrYcnhFCQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027