UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4ARfk5Pdmq6+v1kNhdr0VPDDAXeCMP51g+gMDxns1mU='
WHERE
key_id = '15788700411feb4befbc7460a2c79631779730fde6ac1ec7b0141feab86883b3'
AND (
token = '4ARfk5Pdmq6+v1kNhdr0VPDDAXeCMP51g+gMDxns1mU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)