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