UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rKUKldoPBTo+t1ycqcECxNwTD/2JgWhwuNFoyy2fUeY='
WHERE
key_id = '0e4bf4a338245f367290d856c78c7e1b0c56a1475898270aecf365869bd55042'
AND (
token = 'rKUKldoPBTo+t1ycqcECxNwTD/2JgWhwuNFoyy2fUeY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)