UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JMlknpC+CUd949nU8fUW4x9RaeY4+JhI1XMqXuNUdo4=' 
WHERE 
  key_id = '0681178b1c092892af1286535b504d0fdc41b4de6a8a28496dda58f2dc4cd25b' 
  AND (
    token = 'JMlknpC+CUd949nU8fUW4x9RaeY4+JhI1XMqXuNUdo4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036