UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6at7q634QRtKoT1f78qOJKeVrLSK1eRsGNcIKT0IRJM='
WHERE
key_id = '877f3280a1a4b32d60123061428d2ced174be1416578a661bb01b7c3cafd5112'
AND (
token = '6at7q634QRtKoT1f78qOJKeVrLSK1eRsGNcIKT0IRJM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)