UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ud58ZvtMDFd+U5L8Pkc8cRhWNAC0KdCy/Y2BmtQAPro='
WHERE
key_id = 'c089a37de943f90b4a637ac72d4fe4121a60c73ea83da51ff873c71747ae7aab'
AND (
token = 'Ud58ZvtMDFd+U5L8Pkc8cRhWNAC0KdCy/Y2BmtQAPro='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)