UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1am9r4QSsSebblEOgIdtLmtFRlYGIMmiSwG3gXOy80o='
WHERE
key_id = '878e44b881e2f4eab8348d9d613d640de31d08bcf2d8bddb0fc242d54db43c8e'
AND (
token = '1am9r4QSsSebblEOgIdtLmtFRlYGIMmiSwG3gXOy80o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)