UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5WdiugrmNY60sRgS2Dx3qWdAFsxZAztE26dLdmlHs4o='
WHERE
key_id = 'ac81184465e1dfc601a54d6def35826774fae31f9b6593c0f3af3e8a773234a8'
AND (
token = '5WdiugrmNY60sRgS2Dx3qWdAFsxZAztE26dLdmlHs4o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)