UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KGwBrS8s+sOWh9tmQ46Pw9pxDe8slIC5u4+j98zoqAs='
WHERE
key_id = '5cd86b5088cf29eb7d55db3099036e8c888c1bb5835eabe65c301422d0679210'
AND (
token = 'KGwBrS8s+sOWh9tmQ46Pw9pxDe8slIC5u4+j98zoqAs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)