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