UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hIQTBEMYclaS2KJDWnTfPjPtPo2CoMpb/YSV+P6AJMY='
WHERE
key_id = '17a68978c13635518e7b9a066d705220602ea415bc009cf243080b812b68fe8c'
AND (
token = 'hIQTBEMYclaS2KJDWnTfPjPtPo2CoMpb/YSV+P6AJMY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)