UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v5HDBzixnSTpQZDd6AQJIA3KKMafY8sUVqXcla1+fRY='
WHERE
key_id = 'e48aa965e2e5352ec0bdfe7b16324ea54686ebc3ab1281655b23b0816b3231fc'
AND (
token = 'v5HDBzixnSTpQZDd6AQJIA3KKMafY8sUVqXcla1+fRY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)