UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vddFDqybhSs7Zpbw7MaMjzDzCbecXGgeejw95wtbZJI='
WHERE
key_id = '3ed1f77f9f02dc27ea67ab5809b5338b53ebfd02d4df1fa783ebfa36157547df'
AND (
token = 'vddFDqybhSs7Zpbw7MaMjzDzCbecXGgeejw95wtbZJI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)