UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wo5Ez1k8Xvmbo5p3M6eDvD97syHDFUX210WhPuTw74I='
WHERE
key_id = 'b1990763f417e3f24413404e889b971dba63d171d7e091295c0f2f32f6ccacaf'
AND (
token = 'wo5Ez1k8Xvmbo5p3M6eDvD97syHDFUX210WhPuTw74I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)