UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gn9n4KXifcjVvGr8b+jjZ6rp71fCzSIoAJyvvUS85+A=' 
WHERE 
  key_id = 'c32ef0cc6a3b4edd28b840944e1dc135a15ec912e7f409b049153d8d5d94f7e8' 
  AND (
    token = 'gn9n4KXifcjVvGr8b+jjZ6rp71fCzSIoAJyvvUS85+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00074