UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lwmTa5Mi0SqM8PLudshwztkOFy97C8gc8M8E/m3HTCU='
WHERE
key_id = '91fdcb55006a2ab1a023fc05f330d60a872e294a1dc0d79fb65c13820db47654'
AND (
token = 'lwmTa5Mi0SqM8PLudshwztkOFy97C8gc8M8E/m3HTCU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)