UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X8xxImC7IQHnH1uOMvY//WgRtqSGQtUcUeLLdJi2O08='
WHERE
key_id = '848328640cd095dc5c984a6254b5e3fbc1a67d5d1f04c1b10418d9122de27802'
AND (
token = 'X8xxImC7IQHnH1uOMvY//WgRtqSGQtUcUeLLdJi2O08='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)