UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9pNmRnzBGvoRPT657YgdwDsf60BHSEY0UvhUbn2fjh8=' 
WHERE 
  key_id = '0870bacd027edbff8810455f0207574875c68252c888403b5502187b1998b57e' 
  AND (
    token = '9pNmRnzBGvoRPT657YgdwDsf60BHSEY0UvhUbn2fjh8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028