UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DjRB3QPCHD1B8yBV3A5CJ2DkccVLvH+qEKojNtGdUkA='
WHERE
key_id = 'f7dfcbdf302dc380d3c12cc729a8848f1c1e1f72a9379431930d3746b7fd981b'
AND (
token = 'DjRB3QPCHD1B8yBV3A5CJ2DkccVLvH+qEKojNtGdUkA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)