UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oYXg9QpEPNCgHbdOqyhgeMyzZm980eiPxVwBKo5vFuk='
WHERE
key_id = '2ca7232bb831acf41674a923ea012c5d914abe77264d7f255c5ef0051099def6'
AND (
token = 'oYXg9QpEPNCgHbdOqyhgeMyzZm980eiPxVwBKo5vFuk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)