UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JuqbcA49Y4vajKWnktOMidoDEElnCnQBNo+P64fw+4c='
WHERE
key_id = '0a2443b52b5b93802794388572ff9df484b68f58fbaa8e669c3f956789a12911'
AND (
token = 'JuqbcA49Y4vajKWnktOMidoDEElnCnQBNo+P64fw+4c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)