UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0Zo2QIk1tzqcyjslTgaTj+V6hwhj0YjUk0SO8rRdwSE=' 
WHERE 
  key_id = 'a84ebe544c9c28fe9bcad8a7a866a4702d8f38cd43abe9cab6745847904d16ac' 
  AND (
    token = '0Zo2QIk1tzqcyjslTgaTj+V6hwhj0YjUk0SO8rRdwSE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041