UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XL493PQ/kb8cuoNwUEmQShg1sNKgUILsCaS6b/Wdil0=' 
WHERE 
  key_id = 'e312c04e6d3fd01156551ec1d1ec2d445d0b52f32fe3e94e91b6b92a9049d056' 
  AND (
    token = 'XL493PQ/kb8cuoNwUEmQShg1sNKgUILsCaS6b/Wdil0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036