UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CYAL9UMuKfM97Xobz7EuNhO8+caisSdh8Tzmftk2+mg='
WHERE
key_id = '616e29436aa02f2fef52ac88914fdce9f1c1fbc1c18bac0f27b1a2b9c4ba7fe2'
AND (
token = 'CYAL9UMuKfM97Xobz7EuNhO8+caisSdh8Tzmftk2+mg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)