UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q9zigZcrGkrslnBY2XTLQetDH78+JDGVhwHOMIfgznQ=' 
WHERE 
  key_id = 'aa32eb25255775fd61603af0906d5a4b848be2c4a02161f26d5ac8fde95c1fbf' 
  AND (
    token = 'q9zigZcrGkrslnBY2XTLQetDH78+JDGVhwHOMIfgznQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041