UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jsjS6KBlohOnhYAWkysj9tNl8fAzl1aIAHIrijALCiU=' 
WHERE 
  key_id = 'cefbb4972dde73efedba01c413f0482975c9094596f52b9a3f808c631e4e38fd' 
  AND (
    token = 'jsjS6KBlohOnhYAWkysj9tNl8fAzl1aIAHIrijALCiU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040