UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xE54JOafERw0Ny3kHKzSm3NIL6nzP9X0AEf3IpT0mLo='
WHERE
key_id = '1334840f2127118a2e82cc336ed75312c1537e6725e3422412b4f5de408dd9ba'
AND (
token = 'xE54JOafERw0Ny3kHKzSm3NIL6nzP9X0AEf3IpT0mLo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)