UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NRv9qsRUe4T6EmsjwrwVOEdRBcl9zGFl3sGsUiw3yTs='
WHERE
key_id = '0c02ca2473e5f625a1e13189866a71b30a7195bd15b36d47ed272bdc4f5fcb4e'
AND (
token = 'NRv9qsRUe4T6EmsjwrwVOEdRBcl9zGFl3sGsUiw3yTs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)