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