UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YS/L+tCS7gRZFgGi036hA6h79HXpPkMqNlchEmIKEfA=' 
WHERE 
  key_id = '04ecf3bdb9decbca18161e07bceb4b14b76681fcc64351d67161b32bc07d99f7' 
  AND (
    token = 'YS/L+tCS7gRZFgGi036hA6h79HXpPkMqNlchEmIKEfA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024