UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '391yBBufsYrDiZXD5hbzILThJ+g4ZtEeQTgTP8jS1sE=' 
WHERE 
  key_id = 'ebf16f02c8b2eb8eb03f551d813773e8d79e096cf22bc0a84eb194dda77e7dc9' 
  AND (
    token = '391yBBufsYrDiZXD5hbzILThJ+g4ZtEeQTgTP8jS1sE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027