UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yek71kTfV1XZEsy6WfA6VK47t19uPSDIfjrcniqOADQ=' 
WHERE 
  key_id = 'a282e3fe8ca641802b88257771e1484fb9311c01993557db415b48ce8244cbc9' 
  AND (
    token = 'yek71kTfV1XZEsy6WfA6VK47t19uPSDIfjrcniqOADQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018