UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GXr3JuVHSABPEPyN1BDkxV909ksnPXbLuglFjqesDBE='
WHERE
key_id = 'aaff214918b9b9d8f75986ba2f7260085727c9ab2e33e8a498b145fbec6631cc'
AND (
token = 'GXr3JuVHSABPEPyN1BDkxV909ksnPXbLuglFjqesDBE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)