UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GJvU8WN6EtMxeh1Nk28xGlFeF08orHzuRkYw0B07OKQ='
WHERE
key_id = 'a434ab43ea598673149437155df3fbeeb9b2bc41af31407a37959a758d02b59c'
AND (
token = 'GJvU8WN6EtMxeh1Nk28xGlFeF08orHzuRkYw0B07OKQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)