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