UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XEej738qakZezMEsDCHqkL6hvMm+FZdbupwtqCGBepg=' 
WHERE 
  key_id = '7ecfe7dc0d938d0764651e14c2f24f95ea93b349d9d200f5aabc7c2a59355e72' 
  AND (
    token = 'XEej738qakZezMEsDCHqkL6hvMm+FZdbupwtqCGBepg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032