UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'puZXgLqF248Uud5kyeTLVe0dnxTfTKaZWN6eHruN/+8=' 
WHERE 
  key_id = 'e2a0d4c4743c1c70410bc17ea4cc5a44a39a1e4fafe46d76e69f297858e767a2' 
  AND (
    token = 'puZXgLqF248Uud5kyeTLVe0dnxTfTKaZWN6eHruN/+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047