UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7QP1FvU1S9z9ogC92KbY1wU8UCfWCa6nVGfrAr+PreQ='
WHERE
key_id = '2f099b2b4aabe2d9f6f659e8e01ba707b7e1a4bc2400a54631e173e6fe26e8f7'
AND (
token = '7QP1FvU1S9z9ogC92KbY1wU8UCfWCa6nVGfrAr+PreQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)