UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2W9PTcQ7lX+IKsEEIcJKD67MBE59Qhovt9vEVX+Omk4='
WHERE
key_id = 'bdc6d0ed3132c45447c63fd47d37dbe24bdbc1c071c88f7330dc6892a995ab3d'
AND (
token = '2W9PTcQ7lX+IKsEEIcJKD67MBE59Qhovt9vEVX+Omk4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)