UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l1AlcOyRBkokQaNlvXZI/ip4CPEAq1QHguceiBoQBN0='
WHERE
key_id = 'd5a6a693108947c68e6a3e924e58d331d3d1b3e01c58838427e43e4104ffc7a2'
AND (
token = 'l1AlcOyRBkokQaNlvXZI/ip4CPEAq1QHguceiBoQBN0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)