UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aiT46P3Vn964m4vg9wCCZZjG5vrwZlrI7wWomTax8xM='
WHERE
key_id = '4242885427225a623c60adddf491b7439afc7732e48ad5631bcd938d42bbb738'
AND (
token = 'aiT46P3Vn964m4vg9wCCZZjG5vrwZlrI7wWomTax8xM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)