UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z7EX/lXUkwo+hsktXNT3VN3UGm/lQQ5L9xRCyMMbYQQ=' 
WHERE 
  key_id = 'e07321c3df61b9c7ac3937a73d34c1935d56106ed643822f1afb6d6a21f42451' 
  AND (
    token = 'Z7EX/lXUkwo+hsktXNT3VN3UGm/lQQ5L9xRCyMMbYQQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036