UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HGE27vbgkZyayARsZwPXVy5uCuJfrDnj4FGL+zc1D+8=' 
WHERE 
  key_id = '87f4afea13b5c6dd51e46853264e36a9d04cc3a9454a39ed3fdd52118da2742a' 
  AND (
    token = 'HGE27vbgkZyayARsZwPXVy5uCuJfrDnj4FGL+zc1D+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024