UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tLE4zFMhL8x+jBA1gMvrasjqegBpTta1IJkC1UiZMcU='
WHERE
key_id = '816eb0b00446ba5ca593a23c42dd362e9d1145924c75a1fe4da29e54e8b469ac'
AND (
token = 'tLE4zFMhL8x+jBA1gMvrasjqegBpTta1IJkC1UiZMcU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)