UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lXax4iwZtwmo2ETdevoa4TN2RbnPDOQ4rd3q5Fx0Xa0=' 
WHERE 
  key_id = '970d3621b5520ad46dee751f8cadec24e5e8d213fe2a2d8c04f315e7df5d4d8e' 
  AND (
    token = 'lXax4iwZtwmo2ETdevoa4TN2RbnPDOQ4rd3q5Fx0Xa0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034