UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c6at3D0bKQLnzAu4cb2ufkqUSUIwA3XbR9tWGxfHMd0=' 
WHERE 
  key_id = '674763ee043a1b8207a143d500561fd1c0e20f4b9975a6bea5a399bb793b2709' 
  AND (
    token = 'c6at3D0bKQLnzAu4cb2ufkqUSUIwA3XbR9tWGxfHMd0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035