UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Kr4nTvPQZHHukPxz+k7zld91fk2Z+aNXEHs9inmv9i4='
WHERE
key_id = 'e817fa7e3d6acbb1797e20829553458242b85be43577a8ceeb32be882d7040b6'
AND (
token = 'Kr4nTvPQZHHukPxz+k7zld91fk2Z+aNXEHs9inmv9i4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)