UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q7Hw7zuld3eNi0aTYbCbtd+o68LXMNsRF/7yc+VRULg='
WHERE
key_id = 'b082568d05a6ed712da43a5e2f088a63b7f1511d8fe13201b52bf3ddbac24297'
AND (
token = 'Q7Hw7zuld3eNi0aTYbCbtd+o68LXMNsRF/7yc+VRULg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)