UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S5N1ZOMQEnZ5JTMEc3e7VdCZ2fPawvgZJaDlxmuq9yU=' 
WHERE 
  key_id = '2a76682921abcbbb70ddbaa8debd865a63bdb540e67332dc358e7f291cc4bec2' 
  AND (
    token = 'S5N1ZOMQEnZ5JTMEc3e7VdCZ2fPawvgZJaDlxmuq9yU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018